<template>
  <div>
    <v-chart theme="macarons" :options="option" autoresize style="width: 100%"/>
  </div>
</template>

<script>
import ECharts from 'vue-echarts/components/ECharts'
import 'echarts/theme/macarons'
export default {
  props: {
    piedata: Object
  },
  components: {
    'v-chart': ECharts
  },
  data () {
    return {
      option: {
        title: {
          text: this.piedata.title,
          x: 'center'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
          show: true,
          orient: 'vertical',
          bottom: 'bottom',
          data: this.piedata.dataMain
        },
        series: [
          {
            name: '访问来源',
            type: 'pie',
            radius: [20, 110],
            center: ['50%', '50%'],
            roseType: 'radius',
            lableLine: {
              normal: {
                show: false
              },
              emphasis: {
                show: true
              }
            },
            data: this.piedata.dataValue,
            itemStyle: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  }
}
</script>
